package com.woniuxy.microsportsserver.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringMvcConfigure implements WebMvcConfigurer {
    /**
     * 跨域支持
     * @param registry r
     */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                //允许所有的请求
                .allowedOrigins("*")
                //允许做身份认证
                .allowCredentials(true).
                //允许支持的跨域方法有哪些
                allowedMethods("GET","POST","PUT","DELETE");
    }
}
